﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace Doo.WebUI
{
    public class WidgetUserControl : UserControl, Doo.WebUI.SiteBuilder.IWidgetControl
    {
        public bool EnableCache { get; set; }
        /// <summary>
        /// 使用key1+key2+key3，可有多组由逗号分隔
        /// </summary>
        public string ServerCacheKeys { get; set; }
        public string ClientCacheKeys { get; set; }

        public ResourceManager ResourceManger
        {
            get { return WebManager.Current.ResourceManager; }
        }

        public WebManager WebManager
        {
            get { return WebManager.Current; }
        }

        protected override void Render(HtmlTextWriter writer)
        {
            if (EnableCache)
            {
                WebManager.AddCacheKeys(ServerCacheKeys, ClientCacheKeys);
            }
            base.Render(writer);
        }
    }
}
